<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>8. 获取p标签内部文案</title>
</head>
<body>
    <p class='demo'>hello JavaScript</p>
    <script>
        let demo = document.querySelector("p.demo[class='demo']");
        let demo_value = demo.innerText;
        console.log(demo_value);
        // 通过CSS选择器获取p标签.
    </script>
</body>
</html>